const fs = require('fs')
const json = require('../locales/com.en.json')
console.log(json)
// const data = fs.readFileSync('./locales/com.en.json','utf8')
// const temp = JSON.parse(data)
const data = {
  name: 'John Doe',
  age: 30,
  email: 'john.doe@example.com'
}
const path = './output/result.js'

function writeFile () {
  // const objectModule = `module.exports = ${JSON.stringify(data, null, 2)};`
  // const objectScript = `const myObject = ${JSON.stringify(data, null, 2)};\n\nmodule.exports = myObject;`;
  // fs.writeFileSync(path, objectScript)
  const out  = fs.createWriteStream(path, data, { flags: 'w', start: 0,  encoding: "utf8" })
}
fs.stat(path, (err) => {
  // console.log(JSON.parse(json))
  // if (err) {
  //   fs.mkdir('output' , () => {
  //     writeFile()
  //   })
  // } else {
  //   writeFile()
  // }
})